﻿<%@ Page theme="ThemeBlue" Language="C#" MasterPageFile="~/DefaultMasterPage.master" AutoEventWireup="true" Inherits="_Default" Title="Bank Accounts" Codebehind="Default.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMain" Runat="Server">
        <asp:GridView ID="GridViewAccount" runat="server" AutoGenerateColumns="False" DataKeyNames="AccountID"
            DataSourceID="AccessDataSourceBank" CellPadding="4" ForeColor="#333333" GridLines="None">
            <SelectedRowStyle BackColor="#FF9933" ForeColor="#333333" Font-Bold="True" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="AccountID" HeaderText="AccountID" InsertVisible="False"
                    ReadOnly="True" SortExpression="AccountID" />
                <asp:BoundField DataField="AccountName" HeaderText="AccountName" SortExpression="AccountName" />
                <asp:BoundField DataField="Balance" HeaderText="Balance" SortExpression="Balance" />
            </Columns>
            <RowStyle BackColor="#EFF3FB" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#6600CC" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSourceBank" runat="server" DataFile="~/App_Data/Bank.mdb"
            SelectCommand="SELECT * FROM [Accounts]"></asp:AccessDataSource>
        <br />
        &nbsp;<asp:GridView ID="GridViewTranfer" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
            DataSourceID="AccessDataSourceTranfer" CellPadding="4" ForeColor="#333333" GridLines="None">
            
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                    SortExpression="ID" />
                <asp:BoundField DataField="FromAccount" HeaderText="FromAccount" SortExpression="FromAccount" />
                <asp:BoundField DataField="ToAccount" HeaderText="ToAccount" SortExpression="ToAccount" />
                <asp:BoundField DataField="Total" HeaderText="Total" SortExpression="Total" />
                <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
            </Columns>
            <EmptyDataTemplate>
                There is no tranfer information for this account.
            </EmptyDataTemplate>
            <RowStyle BackColor="#EFF3FB" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#FF9933" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#6600CC" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSourceTranfer" runat="server" DataFile="~/App_Data/Bank.mdb"
            SelectCommand="SELECT * FROM [Transfers] WHERE ([FromAccount] = ?) OR ([ToAccount] = ?) ORDER BY [Date] DESC">
            <SelectParameters>
                <asp:ControlParameter ControlID="GridViewAccount" Name="FromAccount" PropertyName="SelectedValue"
                    Type="Int32" />
                <asp:ControlParameter ControlID="GridViewAccount" Name="ToAccount" PropertyName="SelectedValue"  Type="int32"/>
            </SelectParameters>
        </asp:AccessDataSource>
</asp:Content>

